package com.edais.service.imp;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.edais.actions.PerMatchDetailAction;
import com.edais.dao.AssetsDao;
import com.edais.dao.UserDao;
import com.edais.domain.Finance;
import com.edais.domain.User;
import com.edais.service.AssetsService;
import com.edais.util.CommonUtil;
import com.edais.util.Consts;
import com.edais.util.Message;
import com.edais.vo.AssetsVo;

@Service

@Transactional(propagation=Propagation.SUPPORTS,readOnly=true)
public class AssetsServiceImp implements AssetsService {
	private static final Log logger = LogFactory.getLog(PerMatchDetailAction.class);

	@Autowired
	private AssetsDao assetsDao;
	
	@Autowired
	private UserDao userDao;

	/**
	 * 我的资产明细
	 * @param 用户id
	 */
	@Override
	@Transactional(propagation=Propagation.REQUIRED,rollbackFor=Exception.class,readOnly=false)
	public Map<String, Object> getAssetDetail(String userId) throws Exception{
		Map<String, Object> rtnMap = new HashMap<String, Object>();
		List<AssetsVo> assetsVoList = new ArrayList<AssetsVo>();
		
		String transCode = "E330005";
		StringBuffer productType = new StringBuffer();
		
		// 取得产品列表
		List<Finance> financeList = this.getFinanceList();
		for (Finance finance : financeList) {
			AssetsVo assetsVo = new AssetsVo();
			assetsVo.setFinanceID(String.valueOf(finance.getId()));
			assetsVo.setFinanceName(finance.getName());
			assetsVo.setFinanceUsedMoney(String.valueOf(BigDecimal.ZERO.setScale(2)));
			
			assetsVoList.add(assetsVo);
		}
		
		// 设置产品类型
		if (assetsVoList == null || assetsVoList.size() == 0) {
			productType.append("");
		} else {
			for (int i = 0; i < assetsVoList.size(); i++) {
				AssetsVo assetsVo = assetsVoList.get(i);
				productType.append(assetsVo.getFinanceID());
				
				if (i != assetsVoList.size() - 1) {
					productType.append(", ");
				}
			}
		}
		
		// 设置报文体报文数据
		Map<String, Object> pageModelForWallet = new HashMap<String, Object>();

		pageModelForWallet.put("userId", userId); // 用户id
		// 产品类型：101 e计划(90天)，102 e贷通，103 涨薪宝, 104 e计划(365天),多个产品之间用英文【,】进行分隔
		pageModelForWallet.put("productType", productType.toString());

		// 构建json字符串
		String jsonStr = CommonUtil.constructJsonStr(transCode, userId, pageModelForWallet);
		
		// 调用核心接口
		String rtnStr = CommonUtil.getCoreValue(jsonStr);
		JSONObject jsonObject = JSONObject.fromObject(rtnStr);
		// rescode = "00000"
		if(Consts.SUCCESS_CODE.equals(jsonObject.get("rescode"))){
			// 投资资产合计
			BigDecimal investmentAssets = BigDecimal.ZERO.setScale(2);
			// 现金资产合计
			BigDecimal cashAssets = BigDecimal.ZERO.setScale(2);
			// 账户总资产
			BigDecimal accountTotalAssets = BigDecimal.ZERO.setScale(2);
			// 账户可用余额
			BigDecimal balanceMoney = BigDecimal.ZERO.setScale(2);
			// 提现中冻结金额
			BigDecimal cashInMoney = BigDecimal.ZERO.setScale(2);
			
			// 投资资产明细
			JSONArray jsonArr = jsonObject.getJSONArray("list");
			if(jsonArr != null && jsonArr.size() > 0){
				for (AssetsVo assetsVo : assetsVoList) {
					for(int i = 0; i < jsonArr.size(); i++){
						JSONObject jsonObj = jsonArr.getJSONObject(i);
						if (assetsVo.getFinanceID().equals(jsonObj.getString("productType"))) {
							assetsVo.setFinanceUsedMoney(String.valueOf(new BigDecimal(jsonObj.getString("productAssets")).setScale(2, BigDecimal.ROUND_DOWN)));
						}
					}
					
					investmentAssets =  investmentAssets.add(new BigDecimal(assetsVo.getFinanceUsedMoney()));
				}
			}
			
			balanceMoney = new BigDecimal(jsonObject.getString("acctBalance")).setScale(2, BigDecimal.ROUND_DOWN);
			cashInMoney = new BigDecimal(jsonObject.getString("drawalFrozen")).setScale(2, BigDecimal.ROUND_DOWN);
			
			cashAssets = balanceMoney.add(cashInMoney);
			accountTotalAssets = investmentAssets.add(cashAssets);
			
			rtnMap.put("investmentAssets", String.valueOf(investmentAssets));
			rtnMap.put("cashAssets", String.valueOf(cashAssets));
			rtnMap.put("accountTotalAssets", String.valueOf(accountTotalAssets));
			rtnMap.put("balanceMoney", String.valueOf(balanceMoney));
			rtnMap.put("cashInMoney", String.valueOf(cashInMoney));
			rtnMap.put("list", assetsVoList);
			
			// 设置返回code
			rtnMap.put("rescode", Consts.SUCCESS_CODE);
			rtnMap.put("resmsg", Consts.SUCCESS_DESCRIBE);
			rtnMap.put("resmsg_cn", "");
		} else {
			logger.debug("=====核心接口调用异常=====");
			logger.debug("核心接口：" + transCode);
			logger.debug("rescode：" + jsonObject.getString("rescode") + "；  resmsg：" + jsonObject.getString("resmsg"));
			rtnMap.put("rescode", Consts.ERROR_CODE);
			rtnMap.put("resmsg", Consts.ErrorMsg.MSG00001);
			rtnMap.put("resmsg_cn", Message.CnDescriptionExpression.BUSINESSE_ERROR);
		}

		return rtnMap;
	}
	
	// 取得产品列表
	private List<Finance> getFinanceList() throws Exception {
		return assetsDao.getFinanceList();
	}
	
	@Override
	public Map<String, Object> getAssets(String userId) throws Exception {
		Map<String, Object> rtnMap = new HashMap<String, Object>();
		
		// 昵称，绑定手机号
		User user = userDao.getUserDetail(userId);
		String mobile = user.getMobile();
		String email = user.getEmail();
		rtnMap.put("userName", null == mobile?(null==email?"":email):mobile);
//		rtnMap.put("phone", null == user.getMobile()?"":user.getMobile());
		
		String transCode = "E330005";
		StringBuffer productType = new StringBuffer();
		
		// 取得产品列表
		List<Finance> financeList = this.getFinanceList();
		
		// 设置产品类型
		if (financeList == null || financeList.size() == 0) {
			productType.append("");
		} else {
			for (int i = 0; i < financeList.size(); i++) {
				Finance finance = financeList.get(i);
				productType.append(finance.getId());
				
				if (i != financeList.size() - 1) {
					productType.append(", ");
				}
			}
		}
		// 设置报文体报文数据
		Map<String, Object> pageModelForWallet = new HashMap<String, Object>();

		pageModelForWallet.put("userId", userId); // 用户id
		// 产品类型：101 e计划(90天)，102 e贷通，103 涨薪宝, 104 e计划(365天),多个产品之间用英文【,】进行分隔
		pageModelForWallet.put("productType", productType.toString());

		// 构建json字符串
		String jsonStr = CommonUtil.constructJsonStr(transCode, userId, pageModelForWallet);
		
		// 调用核心接口
		String rtnStr = CommonUtil.getCoreValue(jsonStr);
		JSONObject jsonObject = JSONObject.fromObject(rtnStr);
		// rescode = "00000"
		if(Consts.SUCCESS_CODE.equals(jsonObject.get("rescode"))){
			// 投资资产合计
			BigDecimal investmentAssets = BigDecimal.ZERO.setScale(2);
			// 现金资产合计
			BigDecimal cashAssets = BigDecimal.ZERO.setScale(2);
			// 账户总资产
			BigDecimal accountTotalAssets = BigDecimal.ZERO.setScale(2);
			// 账户可用余额
			BigDecimal balanceMoney = BigDecimal.ZERO.setScale(2);
			// 提现中冻结金额
			BigDecimal cashInMoney = BigDecimal.ZERO.setScale(2);
			// 还款中冻结金额
			BigDecimal repayFrozen = BigDecimal.ZERO.setScale(2);
			// 累计收益
			BigDecimal incomeAmount = BigDecimal.ZERO.setScale(2);
			// 预计收益
			BigDecimal expectAmount = BigDecimal.ZERO.setScale(2);
			
			// 投资资产明细
			JSONArray jsonArr = jsonObject.getJSONArray("list");
			if(jsonArr != null && jsonArr.size() > 0){
				for(int i = 0; i < jsonArr.size(); i++){
					JSONObject jsonObj = jsonArr.getJSONObject(i);
					investmentAssets =  investmentAssets.add(new BigDecimal(jsonObj.getString("productAssets")).setScale(2, BigDecimal.ROUND_DOWN));
					if(!jsonObj.getString("expectedAmount").equals("") && !jsonObj.getString("expectedAmount").equals("null")) {
						expectAmount =  expectAmount.add(new BigDecimal(jsonObj.getString("expectedAmount")).setScale(2, BigDecimal.ROUND_DOWN));
					}
				}
			}
			
			balanceMoney = new BigDecimal(jsonObject.getString("acctBalance")).setScale(2, BigDecimal.ROUND_DOWN);
			cashInMoney = new BigDecimal(jsonObject.getString("drawalFrozen")).setScale(2, BigDecimal.ROUND_DOWN);
			incomeAmount = new BigDecimal(jsonObject.getString("incomeAmount")).setScale(2, BigDecimal.ROUND_DOWN);
			repayFrozen = new BigDecimal(jsonObject.getString("repayFrozen")).setScale(2, BigDecimal.ROUND_DOWN);
			
			cashAssets = balanceMoney.add(cashInMoney).add(repayFrozen);
			accountTotalAssets = investmentAssets.add(cashAssets);

			rtnMap.put("totalAssets", String.valueOf(accountTotalAssets));
			rtnMap.put("balanceMoney", String.valueOf(balanceMoney));
			rtnMap.put("incomeAmount", String.valueOf(incomeAmount));
			rtnMap.put("cashInMoney", String.valueOf(cashInMoney));//冻结金额
			rtnMap.put("investmentAssets", String.valueOf(investmentAssets));
			rtnMap.put("expectAmount", String.valueOf(expectAmount));
			
			// 设置返回code
			rtnMap.put("rescode", Consts.SUCCESS_CODE);
			rtnMap.put("resmsg", Consts.SUCCESS_DESCRIBE);
			rtnMap.put("resmsg_cn", "");
		} else {
			logger.debug("=====核心接口调用异常=====");
			logger.debug("核心接口：" + transCode);
			logger.debug("rescode：" + jsonObject.getString("rescode") + "；  resmsg：" + jsonObject.getString("resmsg"));
			rtnMap.put("rescode", Consts.ERROR_CODE);
			rtnMap.put("resmsg", Consts.ErrorMsg.MSG00001);
			rtnMap.put("resmsg_cn", Message.CnDescriptionExpression.BUSINESSE_ERROR);
		}

		return rtnMap;
	}
	
	@Override
	public Map<String, Object> getAssetsTerm(String userId, String productType1) throws Exception {
		Map<String, Object> rtnMap = new HashMap<String, Object>();
		
		if(StringUtils.isBlank(userId)){
			rtnMap.put("totalAssets", 0);
			rtnMap.put("balanceMoney", 0);
			rtnMap.put("incomeAmount", 0);
			rtnMap.put("cashInMoney", 0);//冻结金额
			rtnMap.put("investmentAssets", 0);
			rtnMap.put("expectAmount", 0);
			
			rtnMap.put("rescode", Consts.SUCCESS_CODE);
			rtnMap.put("resmsg", Consts.SUCCESS_CN);
			rtnMap.put("resmsg_cn", "用户ID为空");
			
			return rtnMap;
		}
		
		// 昵称，绑定手机号
		User user = userDao.getUserDetail(userId);
		
		String mobile = user.getMobile();
		String email = user.getEmail();
		rtnMap.put("userName", null == mobile?(null==email?"":email):mobile);
//		rtnMap.put("phone", null == user.getMobile()?"":user.getMobile());
		
		String transCode = "E330005";
		StringBuffer productType = new StringBuffer();
		
		// 取得产品列表
		List<Finance> financeList = this.getFinanceList();
		
		// 设置产品类型
		if (financeList == null || financeList.size() == 0) {
			productType.append("");
		} else {
			for (int i = 0; i < financeList.size(); i++) {
				Finance finance = financeList.get(i);
				productType.append(finance.getId());
				
				if (i != financeList.size() - 1) {
					productType.append(", ");
				}
			}
		}
		// 设置报文体报文数据
		Map<String, Object> pageModelForWallet = new HashMap<String, Object>();

		pageModelForWallet.put("userId", userId); // 用户id
		// 产品类型：101 e计划(90天)，102 e贷通，103 涨薪宝, 104 e计划(365天),多个产品之间用英文【,】进行分隔
		pageModelForWallet.put("productType", productType1);

		// 构建json字符串
		String jsonStr = CommonUtil.constructJsonStr(transCode, userId, pageModelForWallet);
		
		// 调用核心接口
		String rtnStr = CommonUtil.getCoreValue(jsonStr);
		JSONObject jsonObject = JSONObject.fromObject(rtnStr);
		// rescode = "00000"
		if(Consts.SUCCESS_CODE.equals(jsonObject.get("rescode"))){
			// 投资资产合计
			BigDecimal investmentAssets = BigDecimal.ZERO.setScale(2);
			// 现金资产合计
			BigDecimal cashAssets = BigDecimal.ZERO.setScale(2);
			// 账户总资产
			BigDecimal accountTotalAssets = BigDecimal.ZERO.setScale(2);
			// 账户可用余额
			BigDecimal balanceMoney = BigDecimal.ZERO.setScale(2);
			// 提现中冻结金额
			BigDecimal cashInMoney = BigDecimal.ZERO.setScale(2);
			// 累计收益
			BigDecimal incomeAmount = BigDecimal.ZERO.setScale(2);
			// 预计收益
			BigDecimal expectAmount = BigDecimal.ZERO.setScale(2);
			
			// 投资资产明细
			JSONArray jsonArr = jsonObject.getJSONArray("list");
			if(jsonArr != null && jsonArr.size() > 0){
				for(int i = 0; i < jsonArr.size(); i++){
					JSONObject jsonObj = jsonArr.getJSONObject(i);
					investmentAssets =  investmentAssets.add(new BigDecimal(jsonObj.getString("productAssets")).setScale(2, BigDecimal.ROUND_DOWN));
					if(!jsonObj.getString("expectedAmount").equals("") && !jsonObj.getString("expectedAmount").equals("null")) {
						expectAmount =  expectAmount.add(new BigDecimal(jsonObj.getString("expectedAmount")).setScale(2, BigDecimal.ROUND_DOWN));
					}
				}
			}
			
			balanceMoney = new BigDecimal(jsonObject.getString("acctBalance")).setScale(2, BigDecimal.ROUND_DOWN);
			cashInMoney = new BigDecimal(jsonObject.getString("drawalFrozen")).setScale(2, BigDecimal.ROUND_DOWN);
			incomeAmount = new BigDecimal(jsonObject.getString("incomeAmount")).setScale(2, BigDecimal.ROUND_DOWN);
			
			cashAssets = balanceMoney.add(cashInMoney);
			accountTotalAssets = investmentAssets.add(cashAssets);

			rtnMap.put("totalAssets", String.valueOf(accountTotalAssets));
			rtnMap.put("balanceMoney", String.valueOf(balanceMoney));
			rtnMap.put("incomeAmount", String.valueOf(incomeAmount));
			rtnMap.put("cashInMoney", String.valueOf(cashInMoney));//冻结金额
			rtnMap.put("investmentAssets", String.valueOf(investmentAssets));
			rtnMap.put("expectAmount", String.valueOf(expectAmount));
			
			// 设置返回code
			rtnMap.put("rescode", Consts.SUCCESS_CODE);
			rtnMap.put("resmsg", Consts.SUCCESS_DESCRIBE);
			rtnMap.put("resmsg_cn", "");
		} else {
			logger.debug("=====核心接口调用异常=====");
			logger.debug("核心接口：" + transCode);
			logger.debug("rescode：" + jsonObject.getString("rescode") + "；  resmsg：" + jsonObject.getString("resmsg"));
			rtnMap.put("rescode", Consts.ERROR_CODE);
			rtnMap.put("resmsg", Consts.ErrorMsg.MSG00001);
			rtnMap.put("resmsg_cn", Message.CnDescriptionExpression.BUSINESSE_ERROR);
		}

		return rtnMap;
	}
	
	/**
	 * K2逻辑用 获取理财金额
	 */
	@Override
	public Map<String, Object> getAssetsTerm(String userId, String productType,String kCodeUseDate,String kCodeUseDays) throws Exception {
		Map<String, Object> rtnMap = new HashMap<String, Object>();
		
		if(StringUtils.isBlank(userId)){
			rtnMap.put("totalAssets", 0);
			rtnMap.put("balanceMoney", 0);
			rtnMap.put("incomeAmount", 0);
			rtnMap.put("cashInMoney", 0);//冻结金额
			rtnMap.put("investmentAssets", 0);
			rtnMap.put("expectAmount", 0);
			
			rtnMap.put("rescode", Consts.SUCCESS_CODE);
			rtnMap.put("resmsg", Consts.SUCCESS_CN);
			rtnMap.put("resmsg_cn", "用户ID为空");
			
			return rtnMap;
		}
		
		// 昵称，绑定手机号
		User user = userDao.getUserDetail(userId);
		
		String mobile = user.getMobile();
		String email = user.getEmail();
		rtnMap.put("userName", null == mobile?(null==email?"":email):mobile);
//		rtnMap.put("phone", null == user.getMobile()?"":user.getMobile());
		
		String transCode = "E330005";
		
		// 设置报文体报文数据
		Map<String, Object> pageModelForWallet = new HashMap<String, Object>();

		pageModelForWallet.put("userId", userId); // 用户id
		// 产品类型：101 e计划(90天)，102 e贷通，103 涨薪宝, 104 e计划(365天),多个产品之间用英文【,】进行分隔
		pageModelForWallet.put("productType", productType);

		pageModelForWallet.put("kCodeUseDate", kCodeUseDate);
		pageModelForWallet.put("kCodeUseDays", kCodeUseDays);
		
		// 构建json字符串
		String jsonStr = CommonUtil.constructJsonStr(transCode, userId, pageModelForWallet);
		
		// 调用核心接口
		String rtnStr = CommonUtil.getCoreValue(jsonStr);
		JSONObject jsonObject = JSONObject.fromObject(rtnStr);
		// rescode = "00000"
		if(Consts.SUCCESS_CODE.equals(jsonObject.get("rescode"))){
			// 投资资产合计
			BigDecimal investmentAssets = BigDecimal.ZERO.setScale(2);
			// 现金资产合计
			BigDecimal cashAssets = BigDecimal.ZERO.setScale(2);
			// 账户总资产
			BigDecimal accountTotalAssets = BigDecimal.ZERO.setScale(2);
			// 账户可用余额
			BigDecimal balanceMoney = BigDecimal.ZERO.setScale(2);
			// 提现中冻结金额
			BigDecimal cashInMoney = BigDecimal.ZERO.setScale(2);
			// 累计收益
			BigDecimal incomeAmount = BigDecimal.ZERO.setScale(2);
			// 预计收益
			BigDecimal expectAmount = BigDecimal.ZERO.setScale(2);
			
			// 投资资产明细
			JSONArray jsonArr = jsonObject.getJSONArray("list");
			if(jsonArr != null && jsonArr.size() > 0){
				for(int i = 0; i < jsonArr.size(); i++){
					JSONObject jsonObj = jsonArr.getJSONObject(i);
					investmentAssets =  investmentAssets.add(new BigDecimal(jsonObj.getString("productAssets")).setScale(2, BigDecimal.ROUND_DOWN));
					if(!jsonObj.getString("expectedAmount").equals("") && !jsonObj.getString("expectedAmount").equals("null")) {
						expectAmount =  expectAmount.add(new BigDecimal(jsonObj.getString("expectedAmount")).setScale(2, BigDecimal.ROUND_DOWN));
					}
				}
			}
			
			balanceMoney = new BigDecimal(jsonObject.getString("acctBalance")).setScale(2, BigDecimal.ROUND_DOWN);
			cashInMoney = new BigDecimal(jsonObject.getString("drawalFrozen")).setScale(2, BigDecimal.ROUND_DOWN);
			incomeAmount = new BigDecimal(jsonObject.getString("incomeAmount")).setScale(2, BigDecimal.ROUND_DOWN);
			
			cashAssets = balanceMoney.add(cashInMoney);
			accountTotalAssets = investmentAssets.add(cashAssets);

			rtnMap.put("totalAssets", String.valueOf(accountTotalAssets));
			rtnMap.put("balanceMoney", String.valueOf(balanceMoney));
			rtnMap.put("incomeAmount", String.valueOf(incomeAmount));
			rtnMap.put("cashInMoney", String.valueOf(cashInMoney));//冻结金额
			rtnMap.put("investmentAssets", String.valueOf(investmentAssets));
			rtnMap.put("expectAmount", String.valueOf(expectAmount));
			
			// 设置返回code
			rtnMap.put("rescode", Consts.SUCCESS_CODE);
			rtnMap.put("resmsg", Consts.SUCCESS_DESCRIBE);
			rtnMap.put("resmsg_cn", "");
		} else {
			logger.debug("=====核心接口调用异常=====");
			logger.debug("核心接口：" + transCode);
			logger.debug("rescode：" + jsonObject.getString("rescode") + "；  resmsg：" + jsonObject.getString("resmsg"));
			rtnMap.put("rescode", Consts.ERROR_CODE);
			rtnMap.put("resmsg", Consts.ErrorMsg.MSG00001);
			rtnMap.put("resmsg_cn", Message.CnDescriptionExpression.BUSINESSE_ERROR);
		}

		return rtnMap;
	}

	
	/**
	 * 累计收益
	 */
	@Override
	public Map<String, Object> serachAccumulatedIncome(String userId) throws Exception {
		Map<String, Object> rtnMap = new HashMap<String, Object>();
		
		String transCode = "E330005";
		StringBuffer productType = new StringBuffer();
		
		// 取得产品列表
		List<Finance> financeList = this.getFinanceList();
		
		// 设置产品类型
		if (financeList == null || financeList.size() == 0) {
			productType.append("");
		} else {
			for (int i = 0; i < financeList.size(); i++) {
				Finance finance = financeList.get(i);
				productType.append(finance.getId());
				
				if (i != financeList.size() - 1) {
					productType.append(", ");
				}
			}
		}
		// 设置报文体报文数据
		Map<String, Object> pageModelForWallet = new HashMap<String, Object>();

		pageModelForWallet.put("userId", userId); // 用户id
		// 产品类型：101 e计划(90天)，102 e贷通，103 涨薪宝, 104 e计划(365天),多个产品之间用英文【,】进行分隔
		pageModelForWallet.put("productType", productType.toString());

		// 构建json字符串
		String jsonStr = CommonUtil.constructJsonStr(transCode, userId, pageModelForWallet);
		
		// 调用核心接口
		String rtnStr = CommonUtil.getCoreValue(jsonStr);
		JSONObject jsonObject = JSONObject.fromObject(rtnStr);
		// rescode = "00000"
		if(Consts.SUCCESS_CODE.equals(jsonObject.get("rescode"))){
			// 累计收益
			BigDecimal incomeAmount = BigDecimal.ZERO.setScale(2);
			
			incomeAmount = new BigDecimal(jsonObject.getString("incomeAmount")).setScale(2, BigDecimal.ROUND_DOWN);
			
			rtnMap.put("incomeAmount", String.valueOf(incomeAmount));
			
			// 设置返回code
			rtnMap.put("rescode", Consts.SUCCESS_CODE);
			rtnMap.put("resmsg", Consts.SUCCESS_DESCRIBE);
			rtnMap.put("resmsg_cn", "");
		} else {
			logger.debug("=====核心接口调用异常=====");
			logger.debug("核心接口：" + transCode);
			logger.debug("rescode：" + jsonObject.getString("rescode") + "；  resmsg：" + jsonObject.getString("resmsg"));
			rtnMap.put("rescode", Consts.ERROR_CODE);
			rtnMap.put("resmsg", Consts.ErrorMsg.MSG00001);
			rtnMap.put("resmsg_cn", Message.CnDescriptionExpression.BUSINESSE_ERROR);
		}
		return rtnMap;
	}
}
